\(\int \sqrt {a-a \sec (c+d x)} \, dx\) [117]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [B] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [F(-1)]

Optimal result

Integrand size = 15, antiderivative size = 38 \[ \int \sqrt {a-a \sec (c+d x)} \, dx=\frac {2 \sqrt {a} \arctan \left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {a-a \sec (c+d x)}}\right )}{d} \]

[Out]

2*arctan(a^(1/2)*tan(d*x+c)/(a-a*sec(d*x+c))^(1/2))*a^(1/2)/d

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 38, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {3859, 209} \[ \int \sqrt {a-a \sec (c+d x)} \, dx=\frac {2 \sqrt {a} \arctan \left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {a-a \sec (c+d x)}}\right )}{d} \]

[In]

Int[Sqrt[a - a*Sec[c + d*x]],x]

[Out]

(2*Sqrt[a]*ArcTan[(Sqrt[a]*Tan[c + d*x])/Sqrt[a - a*Sec[c + d*x]]])/d

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 3859

Int[Sqrt[csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_)], x_Symbol] :> Dist[-2*(b/d), Subst[Int[1/(a + x^2), x], x, b*(C
ot[c + d*x]/Sqrt[a + b*Csc[c + d*x]])], x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 - b^2, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {(2 a) \text {Subst}\left (\int \frac {1}{a+x^2} \, dx,x,\frac {a \tan (c+d x)}{\sqrt {a-a \sec (c+d x)}}\right )}{d} \\ & = \frac {2 \sqrt {a} \arctan \left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {a-a \sec (c+d x)}}\right )}{d} \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.62 (sec) , antiderivative size = 85, normalized size of antiderivative = 2.24 \[ \int \sqrt {a-a \sec (c+d x)} \, dx=-\frac {i \sqrt {1+e^{2 i (c+d x)}} \left (\text {arcsinh}\left (e^{i (c+d x)}\right )+\text {arctanh}\left (\sqrt {1+e^{2 i (c+d x)}}\right )\right ) \sqrt {a-a \sec (c+d x)}}{d \left (-1+e^{i (c+d x)}\right )} \]

[In]

Integrate[Sqrt[a - a*Sec[c + d*x]],x]

[Out]

((-I)*Sqrt[1 + E^((2*I)*(c + d*x))]*(ArcSinh[E^(I*(c + d*x))] + ArcTanh[Sqrt[1 + E^((2*I)*(c + d*x))]])*Sqrt[a
 - a*Sec[c + d*x]])/(d*(-1 + E^(I*(c + d*x))))

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(72\) vs. \(2(32)=64\).

Time = 0.90 (sec) , antiderivative size = 73, normalized size of antiderivative = 1.92

method result size
default \(\frac {2 \sqrt {-a \left (\sec \left (d x +c \right )-1\right )}\, \sqrt {-\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \arctan \left (\sqrt {-\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\right ) \left (\cot \left (d x +c \right )+\csc \left (d x +c \right )\right )}{d}\) \(73\)

[In]

int((a-a*sec(d*x+c))^(1/2),x,method=_RETURNVERBOSE)

[Out]

2/d*(-a*(sec(d*x+c)-1))^(1/2)*(-cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*arctan((-cos(d*x+c)/(cos(d*x+c)+1))^(1/2))*(c
ot(d*x+c)+csc(d*x+c))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 73 vs. \(2 (32) = 64\).

Time = 0.30 (sec) , antiderivative size = 182, normalized size of antiderivative = 4.79 \[ \int \sqrt {a-a \sec (c+d x)} \, dx=\left [\frac {\sqrt {-a} \log \left (-\frac {4 \, {\left (2 \, \cos \left (d x + c\right )^{3} + 3 \, \cos \left (d x + c\right )^{2} + \cos \left (d x + c\right )\right )} \sqrt {-a} \sqrt {\frac {a \cos \left (d x + c\right ) - a}{\cos \left (d x + c\right )}} + {\left (8 \, a \cos \left (d x + c\right )^{2} + 8 \, a \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right )}{\sin \left (d x + c\right )}\right )}{2 \, d}, -\frac {\sqrt {a} \arctan \left (\frac {2 \, {\left (\cos \left (d x + c\right )^{2} + \cos \left (d x + c\right )\right )} \sqrt {a} \sqrt {\frac {a \cos \left (d x + c\right ) - a}{\cos \left (d x + c\right )}}}{{\left (2 \, a \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right )}\right )}{d}\right ] \]

[In]

integrate((a-a*sec(d*x+c))^(1/2),x, algorithm="fricas")

[Out]

[1/2*sqrt(-a)*log(-(4*(2*cos(d*x + c)^3 + 3*cos(d*x + c)^2 + cos(d*x + c))*sqrt(-a)*sqrt((a*cos(d*x + c) - a)/
cos(d*x + c)) + (8*a*cos(d*x + c)^2 + 8*a*cos(d*x + c) + a)*sin(d*x + c))/sin(d*x + c))/d, -sqrt(a)*arctan(2*(
cos(d*x + c)^2 + cos(d*x + c))*sqrt(a)*sqrt((a*cos(d*x + c) - a)/cos(d*x + c))/((2*a*cos(d*x + c) + a)*sin(d*x
 + c)))/d]

Sympy [F]

\[ \int \sqrt {a-a \sec (c+d x)} \, dx=\int \sqrt {- a \sec {\left (c + d x \right )} + a}\, dx \]

[In]

integrate((a-a*sec(d*x+c))**(1/2),x)

[Out]

Integral(sqrt(-a*sec(c + d*x) + a), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 146 vs. \(2 (32) = 64\).

Time = 0.42 (sec) , antiderivative size = 146, normalized size of antiderivative = 3.84 \[ \int \sqrt {a-a \sec (c+d x)} \, dx=\frac {\sqrt {a} \arctan \left ({\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{4}} \sin \left (\frac {1}{2} \, \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right )\right ) + \sin \left (d x + c\right ), {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{4}} \cos \left (\frac {1}{2} \, \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right )\right ) + \cos \left (d x + c\right )\right )}{d} \]

[In]

integrate((a-a*sec(d*x+c))^(1/2),x, algorithm="maxima")

[Out]

sqrt(a)*arctan2((cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1)^(1/4)*sin(1/2*arctan2(sin(2
*d*x + 2*c), cos(2*d*x + 2*c) + 1)) + sin(d*x + c), (cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2
*c) + 1)^(1/4)*cos(1/2*arctan2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1)) + cos(d*x + c))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 65 vs. \(2 (32) = 64\).

Time = 0.56 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.71 \[ \int \sqrt {a-a \sec (c+d x)} \, dx=-\frac {2 \, \sqrt {a} \arctan \left (\frac {\sqrt {2} \sqrt {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a}}{2 \, \sqrt {a}}\right ) \mathrm {sgn}\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right ) \mathrm {sgn}\left (\cos \left (d x + c\right )\right )}{d} \]

[In]

integrate((a-a*sec(d*x+c))^(1/2),x, algorithm="giac")

[Out]

-2*sqrt(a)*arctan(1/2*sqrt(2)*sqrt(a*tan(1/2*d*x + 1/2*c)^2 - a)/sqrt(a))*sgn(tan(1/2*d*x + 1/2*c)^3 + tan(1/2
*d*x + 1/2*c))*sgn(cos(d*x + c))/d

Mupad [F(-1)]

Timed out. \[ \int \sqrt {a-a \sec (c+d x)} \, dx=\int \sqrt {a-\frac {a}{\cos \left (c+d\,x\right )}} \,d x \]

[In]

int((a - a/cos(c + d*x))^(1/2),x)

[Out]

int((a - a/cos(c + d*x))^(1/2), x)